'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  var adminauth = app.middleware.adminauth();
  router.get('/default/index', controller.default.home.index);
  router.get('/default/getArticleList',controller.default.home.getArticleList);
  router.get('/default/getDetail/:id',controller.default.home.getDetail);

  router.get('/admin/index', controller.admin.main.index);
  router.post('/admin/login',controller.admin.main.checkLogin);
  router.get('/admin/checkSession',adminauth,controller.admin.main.checkSession);
  router.post('/admin/addArticle',adminauth,controller.admin.main.addArticle);
  router.post('/admin/updateArticle',adminauth,controller.admin.main.updateArticle);
  router.get('/admin/getArticleList',adminauth,controller.admin.main.getArticleList);
  router.get('/admin/removeArticle/:id',adminauth,controller.admin.main.removeArticle);
  router.get('/admin/getDetail/:id',adminauth,controller.admin.main.getArticleDetailById);
};
